﻿#pragma once

#include "Render/PreRender/PreRenderWidgets.h"

class CVulkanWindow;
class CVulkanTexture2D;

class CVulkanImageWidget
{
public:
    void BindData(const SPreRenderImageWidget& InData);
   
    void Draw(vk::CommandBuffer CommandBuffer);

protected:
    //深度
    float Depth=0.0f;
    //视口
    vk::Viewport Viewport;
    //裁剪,最少一个裁剪矩形，否则会使用上一个元素的裁剪矩形
    //单位是像素
    vk::Rect2D Scissor;
    //左上角的uv坐标
    SVec2 LeftTopUV;
    //右下角的uv坐标,如果图片需要重复
    //则右下角的uv坐标应该大于1
    SVec2 RightBottomUV;

    SColor TintColor;

    //图片资源
    std::shared_ptr<CVulkanTexture2D> Image;

};

//绘制所有的图片控件
class CVulkanImageWidgets
{
public:
    ~CVulkanImageWidgets();

    void PreProcess(const TVector<SPreRenderImageWidget>& AllImageData);

    void CreateSelfRecordTasks(CVulkanWindow *InRenderSurface
        ,SRenderCommandBuffers &OutCmdBuffersToExecute);
protected:
    TVector<CVulkanImageWidget> ImageWidgets;

    vk::CommandBuffer CommandBuffer;
};
